


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
  <title>Coverage Report :: ParkManager</title>
  <style type="text/css">
    @import "../../.css/coverage.css";
  </style>
</head>

<body>
<div class="header"></div>

<div class="content">
<div class="breadCrumbs">
    [ <a href="../../index.html">all classes</a> ]
    [ <a href="../index.html">second.group.bering.parking_system</a> ]
</div>

<h1>Coverage Summary for Class: ParkManager (second.group.bering.parking_system)</h1>

<table class="coverageStats">

<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">ParkManager</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (3/ 3)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    91.7%
  </span>
  <span class="absValue">
    (11/ 12)
  </span>
</td>
</tr>
  <tr>
    <td class="name">ParkManager$_parking_closure1</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
  </tr>
  <tr>
    <td class="name">ParkManager$_parking_closure2</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (1/ 1)
  </span>
</td>
  </tr>
  <tr>
    <td class="name">ParkManager$addPark</td>
  </tr>
  <tr>
    <td class="name">ParkManager$parking$0</td>
  </tr>
<tr>
  <td class="name"><strong>total</strong></td>
<td class="coverageStat">
  <span class="percent">
    100%
  </span>
  <span class="absValue">
    (5/ 5)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    92.9%
  </span>
  <span class="absValue">
    (13/ 14)
  </span>
</td>
</tr>
</table>

<br/>
<br/>


<div class="sourceCode"><i>1</i>&nbsp;package second.group.bering.parking_system
<i>2</i>&nbsp;
<i>3</i>&nbsp;import second.group.bering.parking_system.model.Car;
<i>4</i>&nbsp;/**
<i>5</i>&nbsp; *
<i>6</i>&nbsp; * ParkManager
<i>7</i>&nbsp; *
<i>8</i>&nbsp; * @author Burgess Li, Thomas Chen
<i>9</i>&nbsp; * @date 8/23/2018 4:44 PM
<i>10</i>&nbsp; * @version 1.0
<i>11</i>&nbsp; *
<i>12</i>&nbsp; */
<i>13</i>&nbsp;class ParkManager {
<i>14</i>&nbsp;
<i>15</i>&nbsp;    Map&lt;String, Park&gt; parks = [:]
<i>16</i>&nbsp;
<i>17</i>&nbsp;    boolean addPark(Park park) {
<b class="fc"><i>18</i>&nbsp;        if (park &amp;&amp; !parks[park.id]) {</b>
<b class="fc"><i>19</i>&nbsp;            parks[park.id] = park</b>
<b class="fc"><i>20</i>&nbsp;            return true</b>
<i>21</i>&nbsp;        }
<b class="nc"><i>22</i>&nbsp;        return false</b>
<i>23</i>&nbsp;    }
<i>24</i>&nbsp;
<i>25</i>&nbsp;    String parking(Car car) {
<b class="fc"><i>26</i>&nbsp;        if (car &amp;&amp; parks.values().any { it.hasLocation() }) {</b>
<b class="fc"><i>27</i>&nbsp;            Park park = parks.values().find { it.hasLocation() }</b>
<b class="fc"><i>28</i>&nbsp;            park.parking(car)</b>
<b class="fc"><i>29</i>&nbsp;            return park.id</b>
<i>30</i>&nbsp;        }
<b class="fc"><i>31</i>&nbsp;        return null</b>
<i>32</i>&nbsp;    }
<i>33</i>&nbsp;
<i>34</i>&nbsp;    Car pickup(String parkId, String carNumber) {
<b class="fc"><i>35</i>&nbsp;        if (parkId &amp;&amp; carNumber &amp;&amp; parks.containsKey(parkId) &amp;&amp; parks[parkId].hasCar(carNumber)) {</b>
<b class="fc"><i>36</i>&nbsp;            return parks[parkId].pickup(carNumber)</b>
<i>37</i>&nbsp;        }
<b class="fc"><i>38</i>&nbsp;        return null</b>
<i>39</i>&nbsp;    }
<i>40</i>&nbsp;
<i>41</i>&nbsp;}
</div>
</div>

<div class="footer">
    
    <div style="float:right;">generated on 2018-08-23 17:41</div>
</div>
</body>
</html>
